package com.coocaa.ops.plus.core.third.visionhub;

import com.coocaa.ops.plus.core.third.constant.FeignClientNameConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import java.net.URI;

/**
 * @author bjh
 * @description
 * @date 2020/12/22 19:48
 */
@FeignClient(name = FeignClientNameConstants.VISION_SERVICE)
public interface VisionFeignClient {

    @RequestMapping(value = "/poster/getImgFaceInfoV2", method = RequestMethod.GET)
    String getImgFaceInfo(URI uri, @RequestParam("posterUrl") String posterUrl);

    @RequestMapping(value = "/poster/textDetect", method = RequestMethod.POST,
            consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
    String textDetect(URI uri, @RequestPart("file") MultipartFile file, @RequestParam("type") String type,
                      @RequestParam("withPosition") Integer withPosition);

    @RequestMapping(value = "/poster/drawContour", method = RequestMethod.POST,
            consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
    String drawContour(URI uri, @RequestPart(value = "file", required = false) MultipartFile file,
                       @RequestParam(value = "posterUrl", required = false) String posterUrl);


    @RequestMapping(value = "/poster/checkSimilarity", method = RequestMethod.POST,
            consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
    String checkSimilarity(URI uri, @RequestPart("file") MultipartFile[] files, @RequestParam("javaCall") Integer javaCall);

}
